import { reactive } from 'vue'

interface loginUser{
    email: string;
    password: string;
}

interface rule{
  email: {
    type: string;
    required: boolean;
    trigger: string;
    message: string;
}[];
password: ({
    required: boolean;
    trigger: string;
    message: string;
    min?: undefined;
    max?: undefined;
} | {
    min: number;
    max: number;
    message: string;
    required?: undefined;
    trigger?: string;
})[];
}

export const loginName = reactive<loginUser>({
  email:'',
  password:'',
})

 // 校验
 export const rules = reactive<rule>({
  email:[{ type:'email',required:true,trigger: 'blur',message:'你的邮箱格式不对' },],
  password:[
    {
      required:true,trigger: 'blur', message:'密码不能为空'
      },
  {
    min:6,
    max:15,
    message:'你的密码长度不能少于6位且多于15位',
    trigger:'blur'
  }],
});
